﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core.Filter;
using COFE.Core;

namespace COFE.Core
{
    /// <summary>
    /// Extends ICustomEntryList
    /// </summary>
    public static class ICustomEntryListExtension
    {
        public static void Delete(this ICustomEntryList entryList, IEntryFilter matchFilter)
        {
            entryList.Delete(new IEntryFilter[] { matchFilter });
        }

        public static void AddRange(this ICustomEntryList entryList, IEnumerable<IFileSystemInfo> entries)
        {
            entryList.InsertRange(-1, entries);
        }

        public static void Add(this ICustomEntryList entryList, IFileSystemInfo entry)
        {
            AddRange(entryList, new List<IFileSystemInfo>() { entry });
        }

        public static void Insert(this ICustomEntryList entryList, int index, IFileSystemInfo entry)
        {
            entryList.InsertRange(index, new List<IFileSystemInfo>() { entry });
        }

    }
}
